home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2154 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  46 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: Utrecht.NL.net!news
  3. From: avdelst@box.nl (Andre van der Elst)
  4. Subject: Re: A4000
  5. X-Nntp-Posting-Host: box.nl
  6. Message-ID: <809.6600T1263T1010@box.nl>
  7. Sender: news@inter.NL.net (News at newsutr)
  8. Organization: NLnet
  9. X-Newsreader: THOR 2.2 (Amiga;TCP/IP)
  10. References: <9601271304.AA0007w@cliffe.demon.co.uk>
  11. Date: Sat, 27 Jan 1996 20:11:41 GMT
  12.  
  13.  
  14. Steven Chapman wrote:
  15. >Sorry about the file News item.
  16.  
  17. >
  18. >This has been copied out of the Complete Amiga C book from
  19. >Amiga Shopper and cashes A4000/30 and A4000/40 when run.
  20. >But if fastmem is turned off runs as it should.
  21. >Any idea's or could this be a mother board fault with A4000's.
  22. >Have suppied Executable and source (Complie via SAS).
  23.  
  24. >Steve C.
  25.  
  26. Crashes here too. I think it's the scanf() call in function selection.
  27.  
  28. ---
  29.  char input;
  30.  scanf("%1s",&input);
  31. ---
  32.  
  33. I personally don't like this kind of coding.
  34. MAYBE scanf wants to add a '\0' add the end of the string. This might result
  35. in trashing the stack of your application.
  36.  
  37. Try declaring input as :
  38.   char input[2]
  39.  
  40. And use input[1] where input is used now.
  41.  
  42. Let me know it this works, I can't try it out myself right now.
  43.  
  44. Edwin van der Elst.
  45.  
  46.